require File.dirname(__FILE__) + '/tag_helper'
require 'action_view/helpers/javascript_helper'

module SimpleUjs
  module Helpers
    module JavaScriptHelper
      include ActionView::Helpers::JavaScriptHelper

      alias_method :javascript_tag_without_ujs, :javascript_tag
      def javascript_tag(content)
        return javascript_tag_without_ujs(content) unless should_use_ujs?
        add_to_ujs_handler_list(content) and return nil
      end

    end
  end
end
